<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        input {
            border-bottom-style: none;
            border-top-style: none;
            border-left-style: none;
            border-right-style: none;
        }

        .contentBody {
           width: 100%;
           box-sizing: border-box;
        }

        .container {
            width: 100%;
        }

        input.tytdrq {
            width: 96%;
            text-align: center;
        }

        input.tytdqm {
            width: 96%;
            text-align: center;
        }

        input.tytd {
            width: 92%;
            text-align: center;
        }

        input.tytddf {
            width: 95%;
            text-align: center;
        }

        .wzxx1 {
            font-size: 18px;
            font-weight: 600;
            margin-top: 5px;
        }

        .wzxx2 {
            font-size: 15px;
        }

        td {
            font-size: 14px;
        }

        .bgbt {
            font-size: 18px;
            margin-top: 8px;
            margin-bottom: 4px;
            font-weight: 600;
        }

        .wb {
            display: inline-block;
            float: right;
            margin-top: 16px;
        }

        .wb input {
            border-bottom-style: outset;
            border-top-style: none;
            border-left-style: none;
            border-right-style: none;
        }

        .hhl_button {
            padding-top: 12px;
            width: 100%;
            text-align: right;
        }

        .save_button {
            margin-right: 50px;
        }
    </style>
    <script src="/static/js/jquery.js"></script>
    <script src="/static/js/LodopFuncs.js"></script>
    <script src="/static/js/html2canvas.js"></script>
    <script src="/static/js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<div id="contentBody" class="contentBody">
    <div style="width: 100%">
        <div class="title" style="text-align: center;">
            <h1>铜仁市人民医院住院病人压力性损伤评估表</h1>
        </div>
        <div class="bgbt">压力性损伤（Braden）评分：评分≤ 12 分，需每周评分 1 次。</div>
        <div class="container">
            <table cellspacing="0" border="1" style="width: 100%;table-layout: fixed;text-align: center">
                <tr>
                    <td rowspan="3" width="5.5%">日期</td>
                    <td>项目</td>
                    <td colspan="4">感觉</td>
                    <td colspan="4">潮湿</td>
                    <td colspan="4">活动情况</td>
                    <td colspan="4">行动能力</td>
                    <td colspan="4">营养</td>
                    <td colspan="3">摩擦力和剪切力</td>
                    <td width="4.5%">总23</td>
                    <td rowspan="3" width="6%">签名</td>
                </tr>
                <tr>
                    <td width="3.5%">评分内容</td>
                    <td width="3.5%">完全丧失</td>
                    <td width="3.5%">严重丧失</td>
                    <td width="3.5%">轻度丧失</td>
                    <td width="3.5%">未受损害</td>
                    <td width="3.5%">持久潮湿</td>
                    <td width="3.5%">十分潮湿</td>
                    <td width="3.5%">偶尔潮湿</td>
                    <td width="3.5%">很少潮湿</td>
                    <td width="3.5%">卧床不起</td>
                    <td width="3.5%">局限于椅</td>
                    <td width="3.5%">扶助行走</td>
                    <td width="3.5%">活动自如</td>
                    <td width="3.5%">完全不能</td>
                    <td width="3.5%">严重限制</td>
                    <td width="3.5%">轻度限制</td>
                    <td width="3.5%">不受限制</td>
                    <td width="3.5%">严重不良</td>
                    <td width="3.5%">不良</td>
                    <td width="3.5%">中等</td>
                    <td width="3.5%">良好</td>
                    <td width="3.5%">有</td>
                    <td width="3.5%">有潜在危险</td>
                    <td width="3.5%">无</td>
                    <td>得分情况</td>
                </tr>
                <tr>
                    <td>分</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td>4</td>
                    <td>1</td>
                    <td>2</td>
                    <td>3</td>
                    <td></td>
                </tr>
                <tr>
                    <td><input id="rq1" type="text" name="date" class="tytdrq"/></td>
                    <td></td>
                    <td><input id="gjmqss1" type="text" class="tytd"/></td>
                    <td><input id="gjyzss1" type="text" class="tytd"/></td>
                    <td><input id="gjqdss1" type="text" class="tytd"/></td>
                    <td><input id="gjwsss1" type="text" class="tytd"/></td>
                    <td><input id="cscjcs1" type="text" class="tytd"/></td>
                    <td><input id="cssfcs1" type="text" class="tytd"/></td>
                    <td><input id="csorcs1" type="text" class="tytd"/></td>
                    <td><input id="cshscs1" type="text" class="tytd"/></td>
                    <td><input id="hdqkwcbq1" type="text" class="tytd"/></td>
                    <td><input id="hdqkjbyy1" type="text" class="tytd"/></td>
                    <td><input id="hdqkfzxz1" type="text" class="tytd"/></td>
                    <td><input id="hdqkhdzr1" type="text" class="tytd"/></td>
                    <td><input id="xdnlwqbn1" type="text" class="tytd"/></td>
                    <td><input id="xdnlyzxz1" type="text" class="tytd"/></td>
                    <td><input id="xdnlqdxz1" type="text" class="tytd"/></td>
                    <td><input id="xdnlbsyx1" type="text" class="tytd"/></td>
                    <td><input id="yyyzbl1" type="text" class="tytd"/></td>
                    <td><input id="yybl1" type="text" class="tytd"/></td>
                    <td><input id="yyzd1" type="text" class="tytd"/></td>
                    <td><input id="yylh1" type="text" class="tytd"/></td>
                    <td><input id="mcly1" type="text" class="tytd"/></td>
                    <td><input id="mclyqzwx1" type="text" class="tytd"/></td>
                    <td><input id="mclw1" type="text" class="tytd"/></td>
                    <td><input id="dfqk1" type="text" class="tytddf"/></td>
                    <td><input id="qm1" type="text" class="tytdqm btnSignNurs"/></td>
                </tr>
                <tr>
                    <td><input id="rq2" type="text" name="date" class="tytdrq"/></td>
                    <td></td>
                    <td><input id="gjmqss2" type="text" class="tytd"/></td>
                    <td><input id="gjyzss2" type="text" class="tytd"/></td>
                    <td><input id="gjqdss2" type="text" class="tytd"/></td>
                    <td><input id="gjwsss2" type="text" class="tytd"/></td>
                    <td><input id="cscjcs2" type="text" class="tytd"/></td>
                    <td><input id="cssfcs2" type="text" class="tytd"/></td>
                    <td><input id="csorcs2" type="text" class="tytd"/></td>
                    <td><input id="cshscs2" type="text" class="tytd"/></td>
                    <td><input id="hdqkwcbq2" type="text" class="tytd"/></td>
                    <td><input id="hdqkjbyy2" type="text" class="tytd"/></td>
                    <td><input id="hdqkfzxz2" type="text" class="tytd"/></td>
                    <td><input id="hdqkhdzr2" type="text" class="tytd"/></td>
                    <td><input id="xdnlwqbn2" type="text" class="tytd"/></td>
                    <td><input id="xdnlyzxz2" type="text" class="tytd"/></td>
                    <td><input id="xdnlqdxz2" type="text" class="tytd"/></td>
                    <td><input id="xdnlbsyx2" type="text" class="tytd"/></td>
                    <td><input id="yyyzbl2" type="text" class="tytd"/></td>
                    <td><input id="yybl2" type="text" class="tytd"/></td>
                    <td><input id="yyzd2" type="text" class="tytd"/></td>
                    <td><input id="yylh2" type="text" class="tytd"/></td>
                    <td><input id="mcly2" type="text" class="tytd"/></td>
                    <td><input id="mclyqzwx2" type="text" class="tytd"/></td>
                    <td><input id="mclw2" type="text" class="tytd"/></td>
                    <td><input id="dfqk2" type="text" class="tytddf"/></td>
                    <td><input id="qm2" type="text" class="tytdqm btnSignNurs"/></td>
                </tr>
                <tr>
                    <td><input id="rq3" type="text" name="date" class="tytdrq"/></td>
                    <td></td>
                    <td><input id="gjmqss3" type="text" class="tytd"/></td>
                    <td><input id="gjyzss3" type="text" class="tytd"/></td>
                    <td><input id="gjqdss3" type="text" class="tytd"/></td>
                    <td><input id="gjwsss3" type="text" class="tytd"/></td>
                    <td><input id="cscjcs3" type="text" class="tytd"/></td>
                    <td><input id="cssfcs3" type="text" class="tytd"/></td>
                    <td><input id="csorcs3" type="text" class="tytd"/></td>
                    <td><input id="cshscs3" type="text" class="tytd"/></td>
                    <td><input id="hdqkwcbq3" type="text" class="tytd"/></td>
                    <td><input id="hdqkjbyy3" type="text" class="tytd"/></td>
                    <td><input id="hdqkfzxz3" type="text" class="tytd"/></td>
                    <td><input id="hdqkhdzr3" type="text" class="tytd"/></td>
                    <td><input id="xdnlwqbn3" type="text" class="tytd"/></td>
                    <td><input id="xdnlyzxz3" type="text" class="tytd"/></td>
                    <td><input id="xdnlqdxz3" type="text" class="tytd"/></td>
                    <td><input id="xdnlbsyx3" type="text" class="tytd"/></td>
                    <td><input id="yyyzbl3" type="text" class="tytd"/></td>
                    <td><input id="yybl3" type="text" class="tytd"/></td>
                    <td><input id="yyzd3" type="text" class="tytd"/></td>
                    <td><input id="yylh3" type="text" class="tytd"/></td>
                    <td><input id="mcly3" type="text" class="tytd"/></td>
                    <td><input id="mclyqzwx3" type="text" class="tytd"/></td>
                    <td><input id="mclw3" type="text" class="tytd"/></td>
                    <td><input id="dfqk3" type="text" class="tytddf"/></td>
                    <td><input id="qm3" type="text" class="tytdqm btnSignNurs"/></td>
                </tr>
                <tr>
                    <td><input id="rq4" type="text" name="date" class="tytdrq"/></td>
                    <td></td>
                    <td><input id="gjmqss4" type="text" class="tytd"/></td>
                    <td><input id="gjyzss4" type="text" class="tytd"/></td>
                    <td><input id="gjqdss4" type="text" class="tytd"/></td>
                    <td><input id="gjwsss4" type="text" class="tytd"/></td>
                    <td><input id="cscjcs4" type="text" class="tytd"/></td>
                    <td><input id="cssfcs4" type="text" class="tytd"/></td>
                    <td><input id="csorcs4" type="text" class="tytd"/></td>
                    <td><input id="cshscs4" type="text" class="tytd"/></td>
                    <td><input id="hdqkwcbq4" type="text" class="tytd"/></td>
                    <td><input id="hdqkjbyy4" type="text" class="tytd"/></td>
                    <td><input id="hdqkfzxz4" type="text" class="tytd"/></td>
                    <td><input id="hdqkhdzr4" type="text" class="tytd"/></td>
                    <td><input id="xdnlwqbn4" type="text" class="tytd"/></td>
                    <td><input id="xdnlyzxz4" type="text" class="tytd"/></td>
                    <td><input id="xdnlqdxz4" type="text" class="tytd"/></td>
                    <td><input id="xdnlbsyx4" type="text" class="tytd"/></td>
                    <td><input id="yyyzbl4" type="text" class="tytd"/></td>
                    <td><input id="yybl4" type="text" class="tytd"/></td>
                    <td><input id="yyzd4" type="text" class="tytd"/></td>
                    <td><input id="yylh4" type="text" class="tytd"/></td>
                    <td><input id="mcly4" type="text" class="tytd"/></td>
                    <td><input id="mclyqzwx4" type="text" class="tytd"/></td>
                    <td><input id="mclw4" type="text" class="tytd"/></td>
                    <td><input id="dfqk4" type="text" class="tytddf"/></td>
                    <td><input id="qm4" type="text" class="tytdqm btnSignNurs"/></td>
                </tr>
                <tr>
                    <td><input id="rq5" type="text" name="date" class="tytdrq"/></td>
                    <td></td>
                    <td><input id="gjmqss5" type="text" class="tytd"/></td>
                    <td><input id="gjyzss5" type="text" class="tytd"/></td>
                    <td><input id="gjqdss5" type="text" class="tytd"/></td>
                    <td><input id="gjwsss5" type="text" class="tytd"/></td>
                    <td><input id="cscjcs5" type="text" class="tytd"/></td>
                    <td><input id="cssfcs5" type="text" class="tytd"/></td>
                    <td><input id="csorcs5" type="text" class="tytd"/></td>
                    <td><input id="cshscs5" type="text" class="tytd"/></td>
                    <td><input id="hdqkwcbq5" type="text" class="tytd"/></td>
                    <td><input id="hdqkjbyy5" type="text" class="tytd"/></td>
                    <td><input id="hdqkfzxz5" type="text" class="tytd"/></td>
                    <td><input id="hdqkhdzr5" type="text" class="tytd"/></td>
                    <td><input id="xdnlwqbn5" type="text" class="tytd"/></td>
                    <td><input id="xdnlyzxz5" type="text" class="tytd"/></td>
                    <td><input id="xdnlqdxz5" type="text" class="tytd"/></td>
                    <td><input id="xdnlbsyx5" type="text" class="tytd"/></td>
                    <td><input id="yyyzbl5" type="text" class="tytd"/></td>
                    <td><input id="yybl5" type="text" class="tytd"/></td>
                    <td><input id="yyzd5" type="text" class="tytd"/></td>
                    <td><input id="yylh5" type="text" class="tytd"/></td>
                    <td><input id="mcly5" type="text" class="tytd"/></td>
                    <td><input id="mclyqzwx5" type="text" class="tytd"/></td>
                    <td><input id="mclw5" type="text" class="tytd"/></td>
                    <td><input id="dfqk5" type="text" class="tytddf"/></td>
                    <td><input id="qm5" type="text" class="tytdqm btnSignNurs"/></td>
                </tr>
            </table>
        </div>
        <div>
            <div class="wzxx1">需请您和家人配合下列安全措施的实施：</div>
            <div class="wzxx2">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="checkbox" id="csss1" name="csss" value="xhkcjmxs"><label
                    for="csss1">保持床铺和衣裤清洁、干燥、舒适、污染后及时更换</label>
                <input type="checkbox" id="csss2" name="csss" value="xhkcjmxs"><label
                    for="csss2">及时翻身</label>
                <input type="checkbox" id="csss3" name="csss" value="xhkcjmxs"><label
                    for="csss3">局部贴透明贴</label>
                <input type="checkbox" id="csss4" name="csss" value="xhkcjmxs"><label
                    for="csss4">保持皮肤清洁、干燥、及时清洗</label>
                <input type="checkbox" id="csss5" name="csss" value="xhkcjmxs"><label
                    for="csss5">局部贴泡沫敷料</label>
                <input type="checkbox" id="csss6" name="csss" value="xhkcjmxs"><label
                    for="csss6">给予气垫床</label>
                <input type="checkbox" id="csss7" name="csss" value="xhkcjmxs"><label
                    for="csss7">给予减压用具</label>
                <input type="checkbox" id="csss8" name="csss" value="xhkcjmxs"><label
                    for="csss8">局部伤口按外科换药处理</label>
                <input type="checkbox" id="csss9" name="csss" value="xhkcjmxs"><label
                    for="csss9">加强营养、采取适当的营养支持措施</label>
            </div>
        </div>
        <div style="width: 100%;height: 47px">
            <div class="wb">
                <label for="hzqz">患者 / 家属签字</label>
                <input type="text" type="text" id="hzqz"/>
            </div>
            <div class="wb">
                <label for="hs">护士</label>
                <input type="text" type="text" id="hs"/>
            </div>
            <div class="wb">
                <label for="riqi">日期</label>
                <input type="text" type="text" id="riqi"/>
            </div>
        </div>
    </div>
</div>
<div class="hhl_button">
    <button class="btn-emr btn-emr-green save_button" id="save">保存</button>
    <button class="btn-emr btn-emr-green" id="print">打印</button>
</div>
</body>
<script>
    (function ($) {
        let Page = {};
        // var argUrl = getRequestUrl(window.location.href);
        Page.Event = {
            staff: {//登录人信息
                name: $('#inpatientName ').text(),
                staffid: $('.member-info-body p', parent.document).data('staffid'),
                wardcode: $(".member-info-name").attr("data-wardcode"),
                hospital_id: $(".member-info-name").data("hospitalid"),
                bedNum: $("#bedNumber").text(),
                age: $('.icon-age', parent.document).text()
            },
            init: function () {
                this.getDetail()
                $("#xm").text(Page.Event.staff.name)
                $("#xb").text($("#inpatientGender").val())
                $("#nl").text(Page.Event.staff.age)
                $("#ch").text(Page.Event.staff.bedNum)
                $("#zyh").text($("#patientNum").text() || '')
                $("#ks").text($("#patientDepartmentName").text() || '')
                this.pageEvent()
            },
            pageEvent: function () {
                let that = this;
                $("input[name='date']").on('click', function () {
                    WdatePicker({
                        dateFmt: 'MM/dd'
                    });
                });
                $("input[name='time']").on('click', function () {
                    WdatePicker({
                        dateFmt: 'HH:mm'
                    });
                });
                $("button[id='save']").on('click', function () {
                    that.save();
                });
                $("button[id='print']").on('click', function  () {
                    that.print();
                });
                $(".btnSignNurs").on("click", function () {
                    var url = "/customPage/edit?menuShortName=nurseSign";
                    // 打开签名页面获取回写
                    var id = $(this).attr("id");
                    layer.open({
                        type: 2,
                        title: '签名',
                        shift: '',
                        content: url + "&isShowStaff=true&parentDomId=" + id,
                        area: ['300px', '210px'],
                        success: function () {
                        },
                        zIndex: '200',
                        scrolling: 'no'
                    });
                });
            },
            save: function () {
                let save = {};
                let that = this;
                //输入信息保存
                $("input[type='text']").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                });
                //多选信息保存
                $("input[type='checkbox']:checked").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                })
                //单选信息保存
                $("input[type='radio']:checked").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                })
                var _args = {
                    // inpatientId:argUrl.inpatientId,
                    hospitalId: Page.Event.staff.hospital_id,
                    assessmentType: 'trsrmyy_ylpgb',
                    assessmentTime: new Date().Format("yyyy-MM-dd,hh:mm:ss"),
                    assessmentId: Page.Event.staff.staffid,
                    assessmentName: Page.Event.staff.name,
                    assessmentDetail: JSON.stringify(save),
                }
                if ($("#recordId").val()) {
                    _args['assessmentDataId'] = $("#recordId").val()
                    that.saveItem('/template/cnStructuredCustomData/update', _args)
                } else {
                    that.saveItem('/template/cnStructuredCustomData/save', _args)

                }
                console.log(_args);
            },
            //调取保存或者修改接口
            saveItem: function (url, param) {
                let that = this
                $.ajax({
                    url: url,
                    async: false,
                    type: 'POST',
                    contentType: "application/json;charset-utf-8",
                    data: JSON.stringify(param),
                    success: function (res) {
                        if (res.state == 200) {
                            layer.msg('保存成功')
                            that.getDetail()
                        }
                    },
                    error: function (msg) {
                        layer.error("保存发生异常!", msg.responseText);
                    }
                });
            },
            //获取详情
            getDetail: function () {
                $.ajax({
                    type: "get",
                    url: '/template/cnStructuredCustomData/getListByCondition',
                    data: {
                        // inpatientId: argUrl.inpatientId,
                        assessmentType: "trsrmyy_ylpgb",
                    },
                    contentType: "application/json;charset=utf-8"
                }).done(function (res) {
                    if (res.state == 200) {
                        if (res.results.result && res.results.result.length > 0) {
                            $("#recordId").val(res.results.result[0].assessmentDataId)
                            let dataItem = JSON.parse(res.results.result[0].assessmentDetail)
                            //数据回显
                            for (let key in dataItem) {
                                //输入信息保存
                                $("input[type='text']").each(function () {
                                    if ($(this).attr('id') == key && key != 'recordId') {
                                        $(this).val(dataItem[key])
                                        $(this).attr('value', dataItem[key])
                                    }
                                })
                                //勾选信息保存
                                $("input[type='checkbox']").each(function () {
                                    if ($(this).attr('id') == key) {
                                        $(this).prop('checked', true)
                                        $(this).attr('checked', 'checked')
                                    }
                                })
                                //单选信息保存
                                $("input[type='radio']").each(function () {
                                    if ($(this).attr('id') == key) {
                                        $(this).prop('checked', true)
                                        $(this).attr('checked', 'checked')
                                    }
                                })
                            }
                        }
                    }
                })
            },
            print: function () {
                document.getElementById('contentBody').style = "width:290mm";
                html2canvas(document.querySelector("#contentBody"),{
                    dpi: 600,
                    allowTaint: true,
                    imageTimeout: 500,
                    useCORS: true,
                    scale: 2
                }).then(canvas => {
                    document.getElementById('contentBody').style = "width:100%";
                    var imgUrl = canvas.toDataURL("image/png"); // 将canvas转换成img的src流
                    // document.getElementById('myImg').src = imgUrl;
                    LODOP.PRINT_INIT("");
                    LODOP.SET_PRINT_PAGESIZE(2, 0, 0,'A4');
                    LODOP.SET_PRINT_STYLE('AngleOfPageInside',-90)
                    LODOP.SET_PRINT_STYLE("Stretch",1);
                    LODOP.ADD_PRINT_IMAGE('2%','2%','96%', '96%',"<img src="+imgUrl+"/>");
                    LODOP.PREVIEW();
                });
            }
        }
        Page.Event.init();
    })(jQuery);
</script>
</html>
